package com.atguigu.a_string;
/*
    直接输出对象名就应该看到对象在内存中的地址值!
    如果看到的不是对象在内存中的地址值,说明 有人在搞鬼 ! [String类重写了toString方法]
 */
public class Demo {
    public static void main(String[] args) {
        //直接赋值
        String str1 = "abc";

        //废物构造
        String str2 = new String();
        String str3 = new String("abc");

        //char[] --> String
        char[] chs = {'a','b','c'};
        String str4 = new String(chs);
        String str5 = new String(chs,0,2);

        //byte[] --> String
        byte[] bys = {97,98,99};
        String str6 = new String(bys);
        String str7 = new String(bys,1,2);

        System.out.println("str1 = " + str1);
        System.out.println("str2 = " + str2);
        System.out.println("str3 = " + str3);
        System.out.println("str4 = " + str4);
        System.out.println("str5 = " + str5);
        System.out.println("str6 = " + str6);
        System.out.println("str7 = " + str7);

    }
}
